/*
 * Author: Panagiotis Papadopoulos
 * Contact: panosjee@gmail.com
 * Date: August 8, 2009
 * Comment: GTUG Campout Meeting
 */

package com.google.wavesurferrobot.data;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

import com.google.wavesurferrobot.data.objects.Token;
import com.google.wavesurferrobot.data.util.PMF;

public class FetchTokenData {

	public static List<Token> fetchDataWavesFromAuthor(String token) {
		PersistenceManager pm = PMF.get().getPersistenceManager();
		
	    Query query = pm.newQuery(Token.class);
	    query.setFilter("token == a_Token");
	    query.declareParameters("String a_Token");
	    List<Token> results = null;
	    try {
	        results = (List<Token>) query.execute(token);
	    } finally {
	        query.closeAll();
	    }
        return results;
	}
	
	/*
	public static List<DataBlip> fetchDataBlipFromWaveID(Long dataWaveletID) {
		PersistenceManager pm = PMF.get().getPersistenceManager();
        String query = "SELECT FROM " + DataWave.class.getName() + " WHERE dataWaveletID == '" + dataWaveletID.toString() + "'";
        List<DataBlip> dataBlipList = (List<DataBlip>) pm.newQuery(query).execute();
        return dataBlipList;
	}
	*/
	
}
